package uniandes.cupi2.photoViewer.interfaz;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridLayout;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JComboBox;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.SwingConstants;

public class DialogoImportar extends JDialog implements ActionListener{
	
	private static final String ACEPTAR = "Aceptar";
	private static final String CANCELAR =	"Cancelar";

	private final JPanel contentPanel = new JPanel();
	private JTextField textField;
	
	private InterfazPhotoViewer principal;
	
	/**
	 * Create the dialog.
	 */
	public DialogoImportar(InterfazPhotoViewer ventana) {
		
		principal = ventana;
		getContentPane().setMaximumSize(new Dimension(300, 200));
		getContentPane().setSize(new Dimension(300, 200));
		getContentPane().setPreferredSize(new Dimension(300, 200));
		getContentPane().setMinimumSize(new Dimension(300, 200));
		setBounds(100, 100, 450, 300);
		getContentPane().setLayout(new BorderLayout());
		contentPanel.setSize(new Dimension(300, 200));
		contentPanel.setPreferredSize(new Dimension(300, 200));
		contentPanel.setMaximumSize(new Dimension(300, 200));
		contentPanel.setMinimumSize(new Dimension(300, 200));
		contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
		getContentPane().add(contentPanel, BorderLayout.CENTER);
		contentPanel.setLayout(new GridLayout(0, 2, 0, 0));
		{
			JLabel lblFoto = new JLabel("Foto: ");
			lblFoto.setHorizontalAlignment(SwingConstants.RIGHT);
			lblFoto.setSize(new Dimension(10, 10));
			lblFoto.setMinimumSize(new Dimension(10, 10));
			lblFoto.setMaximumSize(new Dimension(10, 10));
			lblFoto.setPreferredSize(new Dimension(10, 10));
			contentPanel.add(lblFoto);
		}
		{
			textField = new JTextField();
			textField.setMaximumSize(new Dimension(10, 10));
			textField.setMinimumSize(new Dimension(10, 10));
			textField.setPreferredSize(new Dimension(10, 10));
			textField.setSize(new Dimension(10, 10));
			contentPanel.add(textField);
			textField.setColumns(1);
		}
		{
			JLabel lblAlbum = new JLabel("Album: ");
			lblAlbum.setHorizontalAlignment(SwingConstants.RIGHT);
			contentPanel.add(lblAlbum);
		}
		{
			JComboBox comboBox = new JComboBox();
			contentPanel.add(comboBox);
		}
		{
			JPanel buttonPane = new JPanel();
			buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
			getContentPane().add(buttonPane, BorderLayout.SOUTH);
			{
				JButton okButton = new JButton(ACEPTAR);
				okButton.setActionCommand(ACEPTAR);
				buttonPane.add(okButton);
				getRootPane().setDefaultButton(okButton);
			}
			{
				JButton cancelButton = new JButton(CANCELAR);
				cancelButton.setActionCommand(CANCELAR);
				buttonPane.add(cancelButton);
			}
		}
	}

	public void actionPerformed(ActionEvent cursor)
	{
		String comando = cursor.getActionCommand();
		if(comando.equals(ACEPTAR))
		{
			
		}
		else if(comando.equals(CANCELAR))
		{
			this.dispose();
		}
	}
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			DialogoImportar dialog = new DialogoImportar(null);
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	

}
